package com.hc.feign;


import com.hc.pojo.Meber;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 服务降级 处理类
 */
@Component
public class IMemberFeignFallbackFactory implements FallbackFactory<IMemberFeign> {

    @Override
    public IMemberFeign create(Throwable throwable) {
        return new IMemberFeign() {
            @Override
            public String getMenberById(Integer id) {
                return "当前人数太多请稍等后查看！！！";
            }

            @Override
            public void addMeber(Meber meber) {

            }

            @Override
            public Meber getMenberById2(Integer id) {
                return new Meber(-1,"当前系统流浪去了,稍等在来！");
            }

            @Override
            public List<Meber> getMenberList() {
                return null;
            }
        };
    }
}
